﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Login.aspx.cs" Inherits="ExpertMIS.Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>登录</title>
    <link type="text/css" href="CSS/login.css" rel="Stylesheet" />

    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>

    <script type="text/javascript">
        var seed = Math.random();

        function doRegister() {
            $("#reg-box-bg").show();
            $("#reg-box-bg").animate({ opacity: "0.5" }, "normal");
            var width = $("#reg-box").width();
            var height = $("#reg-box").height();
            $("#reg-box").fadeIn(200);
            $("#reg-box").animate({ left: (($(document).width() - width) / 2) + "px", top: ($(document).scrollTop() + 170) + "px" }, "normal");
        }

        function cancelRegister() {
            $("#reg-box-bg").fadeOut(800);
            $("#reg-box").fadeOut(400);
        }

        function submitRegister() {
            $("#pText").html("");
            if ($("#account").val() == "") {
                $("#pText").html("<span style='font-size:12px;color:red;'>请输入您的账户名称。</span>");
                $("#account").focus();
                return;
            }

            if ($("#passwd1").val() == "") {
                $("#pText").html("<span style='font-size:12px;color:red;'>请设定账户密码。</span>");
                $("#passwd1").focus();
                return;
            }

            if ($("#passwd1").val() != $("#passwd2").val()) {
                $("#passwd1").focus();
                $("#pText").html("<span style='font-size:12px;color:red;'>密码不一致，请重新输入。</span>");
                return;
            }

            var intervalId = setInterval(function() { $("#pText").html($("#pText").html() + '.') }, 200);

            $("#pText").ajaxStop(function() {
                clearInterval(intervalId);
            });

            $("#pText").ajaxError(function(event, request, settings) {
                $("#pText").html("<span style='font-size:12px;color:red;'>注册失败，请重试。</span>");
            });

            $.get('RegisterAction.ashx',
                { account: $("#account").val(), passwd: $("#passwd1").val() },
                function(data) {
                    if (data.error) {
                        $("#pText").html("<span style='font-size:12px;color:red;'>" + data.text + "</span>");
                    }
                    else {
                        window.location = data.url;
                    }
                }, 'json');
            }

            function doChangeVerifyCode(obj) {
                var r = Math.random(seed*100);
                obj.src = "Service/VerifyCode.aspx?w=70&h=20&renew=1&rand=" + r;
                $(".f_ch").focus();
            }
    </script>

</head>
<body>
    <div id="box">
        <div id="head">
            <img src="imgs/login/text.jpg" width="396" height="51" alt="曲靖市人才双向服务平台" /></div>
        <div id="content">
            <div id="c_img">
                <img src="imgs/login/bg_1.jpg" width="77" height="31" /></div>
            <form runat="server" id="frmLogin">
                <div id="form">
                    <div id="f_head" style="padding-left: 46px; padding-top: 8px;">
                        | <a href="#" style="text-decoration: none; font-size: 14px; color: #000000">用户登录</a>
                        <% String sReq = Request["requesturl"];
                                    if(sReq != null){
					if(!sReq.EndsWith("expert=true")) { %>
                        |&nbsp;&nbsp;<a href="#" onclick='doRegister();' style="text-decoration: none; font-size: 14px;
                            color: #000000">用户注册</a>
                        <% }} %>
                        | <a href="Home.aspx" style="text-decoration: none; font-size: 14px; color: #000000;">
                            返回首页</a> |</h1>
                    </div>
                    <p>
                        用户名
                        <asp:TextBox runat="server" ID="txUserID" class="f_user"></asp:TextBox>
                    </p>
                    <p>
                        密<span style="margin-left: 1em;">码</span>
                        <asp:TextBox runat="server" ID="txPassWD" TextMode="Password" class="f_code"></asp:TextBox></p>
                    <p>
                        验证码
                        <asp:TextBox runat="server" ID="txVerifyCode" class="f_ch"></asp:TextBox>
                    </p>
                    <p style="height: 31px; margin-left: 77px; margin-top: 20px;">
                        <asp:Button runat="server" CssClass="btn_login" ID="btnLogin" OnClick="btnLogin_Click" />
                        <asp:Button runat="server" CssClass="btn_cancel" ID="btnCancel" />
                        <div id="from_ch">
                            <img src="Service/VerifyCode.aspx?w=70&h=20" width="70" height="24" alt="请输入图中0-9随机的数字"
                                style="padding-top: 5px; padding-left: 3px;" title="看不清楚，换一张" style="border: 0px;
                                cursor: pointer;" onclick="doChangeVerifyCode(this);" /></div>
                </div>
            </form>
        </div>
        <div id="footer">
            <p>
                版权所有：未经曲靖党建网书面授权，请勿转载或建立镜像，违者依法必究
            </p>
        </div>
    </div>
    <div id="reg-box-bg" onclick="cancelRegister();">
    </div>
    <div id="reg-box">
        <h1>
            注册</h1>
        <h2>
            <input id="close" name="" type="button" onclick="cancelRegister();" /></h2>
        <div id="text">
            <p id="pText" style="text-align: left; padding: 2px 4px 2px 4px; height: 28px; line-height: 22px;
                letter-spacing: 2px;">
            </p>
            <p>
                用户名<input class="input" id="account" name="account" type="text" /></p>
            <p>
                密码<input class="input" id="passwd1" name="passwd" type="password" /></p>
            <p>
                确认密码<input class="input" id="passwd2" type="password" /></p>
            <p style="text-align: center;">
                <input type="button" value="注册" style="width: 60px; border: black 1px solid;" onclick="submitRegister();" />&nbsp;&nbsp;&nbsp;
                <input type="button" value="取消" style="width: 60px; border: black 1px solid;" onclick="cancelRegister();" /></p>
        </div>
    </div>
</body>
</html>
